package com.cy.pj.sys.controller;


import com.cy.pj.common.pojo.JsonResult;
import com.cy.pj.sys.pojo.SysRole;
import com.cy.pj.sys.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SysRoleController {
    @Autowired
    private RoleService roleService;

    @RequestMapping("role/doFindPageObjects")
    public JsonResult findPageObjects(String name, Integer pageCurrent) {
        return new JsonResult(roleService.findPageObjects(name, pageCurrent));
    }

    @RequestMapping("role/doSaveObject")

    public JsonResult saveObject(SysRole entity, Integer[] menuIds) {
        roleService.saveObject(entity, menuIds);
        return new JsonResult("save ok");
    }

    @RequestMapping("role/doFindObjectById")
    public JsonResult findObjectById(Integer id) {
        return new JsonResult(roleService.findObjectById(id));
    }
}
